// pages/member-infoCenter/member-infoCenter.js
import api from '../../utils/api.js'
let app = getApp();
import { HTTP } from "../../utils/http.js";
let http = new HTTP();
import { config } from '../../utils/config'

Page({
    data: {
        // 此页面 页面内容距最顶部的距离
        height: app.globalData.height * 2 + 20,
        messageData: [],
        imgUrl: config.imgUrl,
        messageList: [],
        isMessage:true
    },
    onLoad: function(){
        this.reqList()
    },
    reqList(){
        http.request({
            url: api.myMessage,
            method:'get',
            header: {
                token: wx.getStorageSync('token')
              },
              success: (res) =>{
                  console.log(res)
                  if(res.code == 200){
                    this.setData({
                        messageList:res.data.data
                    })
                    if(res.data.total == 0){
                        this.setData({
                            isMessage:false
                        })
                    }
                  }else{
                      wx.showModal({
                        title : '提示',
                        content:'消息获取失败',
                      })
                  }
              }
        })
    }
})